<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
  <base href="<%=basePath%>">
  <meta charset="utf-8" />
    <title>添加催收记录</title>

 <%-- <link href="static/css/bootstrap.min.css" rel="stylesheet" />--%>
  <link href="static/mycss/bootstrap.min.css" rel="stylesheet" />
    <%--<link href="static/css/bootstrapValidator.css" rel="stylesheet" />
  <script type="text/javascript" src="static/js/layer.js"></script>--%>
	<link rel="stylesheet" href="static/css/layui.css"  media="all">
    <script src='static/js/laydate/laydate.js'></script>
  <script src='static/js/jquery-1.9.1.min.js'></script>
    <script src='static/js/commonJs.js${getTime}'></script>
    <script type="text/javascript" src="static/js/layer.js"></script>
   <%-- <script src='static/js/bootstrap-3.3.7-dist/js/bootstrapValidator.js'></script>--%>
    <script src='static/js/formvalidJs.js'></script>
    <script src='static/js/bootstrap-3.3.7-dist/js/bootstrap.min.js'></script>
    <style>
        .divcss5{width:200px;}
        .divcss6{width:125px;}
    </style>
    <script type="text/javascript">
    $(top.hangge());
    $(document).ready(function(){
        if("${contactsInfoMap}"!=""||"${contactsInfoMap}"!=null){
            $("#toRealName").val("${contactsInfoMap.realName}")
            $("#linkManName").val("${contactsInfoMap.contUserName}")
            if("${contactsInfoMap.contShip}"!="本人" && "${contactsInfoMap.contShip}"!="其他"){
            $("#toMobile").val("${toLinkMobile}")
            }
            if("${contactsInfoMap.contShip}"!=""||"${contactsInfoMap.contShip}"!=null){
                var contship = "${contactsInfoMap.contShip}"
                var contshipId
                if(contship=="本人"){
                    contshipId=1
                    $("#toMobile").val("${toMobile}")
                }else if(contship=="父亲"){
                    contshipId=7
                }else if(contship=="母亲"){
                    contshipId=8
                }else if(contship=="子女"){
                    contshipId=9
                }else if(contship=="配偶"){
                    contshipId=10
                }else if(contship=="亲戚"){
                    contshipId=2
                }else if(contship=="朋友"){
                    contshipId=4
                }else if(contship=="其他"){
                    contshipId=6
                    //下面代码是为了在通讯录中添加催计消息,掩码后催计图标消失
                    $("#toMobile").val("${toMobile}")
                }else{
                    contshipId=""
                }
                $("#callShip").val(contshipId)
            }
        }
        $("#toMobileNoHid").val($("#toMobile").val());//取消手机号掩码
    	$("#callType1").change(function(){
    		$("#callType").val($("#callType1").val());
    	});
    	$("#callResult1").change(function(){
    		$("#callResult").val($("#callResult1").val());
    	});
        var mobolevalue = $("#toMobileNoHid").val();
     if(mobolevalue){
         $("#toMobileNoHid").attr("disabled","disabled")
     }
    });

    function coverMobile(value){
            if(hasRoleOnCover()){
                return value;
            }
            return $.coverCore(value,4,4);

    }

    var  hasRoleOnCover = function(){
        var admin  = '${ADMIN}';
        var cszz  = '${CSZZ}';
        var csjl  ='${CSJL}';
        var role_ID  = '${currentRoleID}';
        if(role_ID == csjl){
            //催收经理
            return  true;
        }else if(role_ID == admin){
            //admin
            return  true;
        }
        return false;

    }
    	function show_confirm(){
          var timeStr =  $("#promiseRepaymentDay").val()
            if(timeStr){
            var tine  = new Date(timeStr);
            var year = tine.getFullYear();
            if(year>2037){
                alert("时间不能大于2037年")
                return;
            }
            }
            var issubmit = $("#commentForm").checkValidy();
            if(issubmit){
                $("#callType").val($("#callType1").val());
                if(!$("#toMobile").val()) {
                    $("#toMobile").val($("#toMobileNoHid").val())
                }
                $("#first").attr("disabled","disabled");
                $("#commentForm").submit();
            }
          //  return issubmit;
    	}
    </script>
</head>
<body>
<br>
<form name="signUpForm" class="form-horizontal m-t" id="commentForm" novalidate="novalidate" method="post" action="cuijimanage/addCuishouRecord.do" <%--onsubmit="return show_confirm()"--%>>
	<input type="hidden" id="callLoanNid" name="callLoanNid" value="${callLoanNid}">
	<input type="hidden" id="callUser" name="callUser" value="${callUser}">
	<input type="hidden" id="callType" name="callType">
	<input type="hidden" id="callResult" name="callResult">
    <%--<input type="hidden" id="promiseRepaymentDay" name="promiseRepaymentDay">
    <input type="hidden" id="toRealName1" name="toRealName" value="${toRealName}">--%>
  <div class="form-group col-sm-12">
    <label class="col-sm-3 control-label divcss6">催收对象姓名<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
    <div class="col-sm-4"  style="display: inline-block;">
    	<input id="toRealName" type="text" class="form-control divcss5"   name="toRealName" value="${toRealName}" placeholder="催收对象" checkName="输入合法姓名" checkIsNull="催收对象不能为空">
    </div>
  </div>
    <div class="form-group col-sm-12">
        <label class="col-sm-3 control-label divcss6">联系人姓名:</label>
        <div class="col-sm-4"  style="display: inline-block;">
            <input id="linkManName" type="text" class="form-control divcss5"   name="linkManName"   placeholder="联系人姓名" checkName="输入合法姓名">
           <%-- <select   class="form-control divcss5" id="linkManId" name="linkManId" checkIsNull="必须选择联系人姓名">
                <option value="">请选择</option>
                <option value= "-1">本人</option>
                <c:forEach  var="linkMan" varStatus="var" items="${linkManList}">
                    <option value= "${linkMan.id}">${linkMan.contUserName}</option>
                </c:forEach>
            </select>--%>
        </div>
    </div>
   <div class="form-group col-sm-12">
    <label class="col-sm-3 control-label divcss6">联系方式<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
    <div class="col-sm-4"  style="display: inline-block;">
    	<input id="toMobileNoHid" type="text" class="form-control divcss5" name="toMobileNoHid" maxlength="20"  placeholder="手机号码" checkIsNull="联系方式不能为空">
        <input id="toMobile" type="hidden" class="form-control divcss5" name="toMobile">
    </div>
  </div>
    <div class="form-group col-sm-12">
        <label class="col-sm-3 control-label divcss6"> 催收关系<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
        <div class="col-sm-4"  style="display: inline-block;">
            <select   class="form-control divcss5" id="callShip" name="callShip" checkIsNull="必须选择催收关系">
                <option value="">请选择</option>
                <c:forEach  var="calltype" varStatus="var" items="${callType}">
                    <option value= "${calltype.key}">${calltype.value}</option>
                </c:forEach>
            </select>
        </div>
    </div>
  <div class="form-group col-sm-12">
    <label class="col-sm-3 control-label divcss6">催收方式<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
    <div class="col-sm-4"  style="display: inline-block;">
      <select   class="form-control divcss5" id="callType1" name="callType1" checkIsNull="必须选择催收方式">
        <option value="">请选择催收方式</option>
        <option value="1" selected = "selected">电话</option>
        <option value="2">网络</option>
        <option value="3">短信</option>
        <option value="4">线下面催</option>
        <option value="5">其他</option>
      </select>
    </div>
  </div>
  <div class="form-group col-sm-12">
    <label class="col-sm-3 control-label divcss6">催收结果<span style="font-family: 'Arial Negreta', 'Arial'; font-weight: 700; color: #FF0000;">*</span>:</label>
    <div class="col-sm-4"  style="display: inline-block;">
      <select   class="form-control divcss5" id="callResult1" name="callResult1" checkIsNull="必须选择催收结果">
        <option value="">请选择催收结果</option>
          <c:forEach  var="calltype" varStatus="var" items="${callresulttypen}">
              <option value= "${calltype.key}">${calltype.value}</option>
          </c:forEach>
      </select>
    </div>
  </div>
    <div class="form-group col-sm-12">
        <label class="col-sm-3 control-label divcss6">承诺还款日期:</label>
        <div class="col-sm-4"  style="display: inline-block;">
            <input id="promiseRepaymentDay"  name="promiseRepaymentDay" autocomplete="off"  Style="width: 200px;height: 35px" class="laydate-icon"  onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
        </div>
    </div>
  <div class="form-group col-sm-12">
    <label class="col-sm-3 control-label divcss6" style="top: -65px";>催收结果说明:</label>
    <div class="col-sm-6"  style="display: inline-block;">
         <textarea rows="3"  maxlength="150"  class="form-control divcss5" id="callResultDesc" name="callResultDesc" placeholder="150字以内"></textarea>
    </div>
  </div>
  <div class="form-group col-sm-12">
    <div align="center" class="col-sm-5" >
      <input id="first" class="btn btn-primary" type="button" onclick="show_confirm();" value="确认保存"/>
    </div>
  </div>
</form>
</body>
</html>
